{% extends "base.html" %}
{% load static %}

{% block headjs %}

{% endblock %}

{% block content %}

    <div class="card">
        <div class="card-header">
            <h3>正式学员列表</h3>
        </div>
    <div class="card-body row">
            <div class="col-sm">
                <a class="btn btn-danger" href="/upload/2/">导入</a>
                <br>
                <small><a href="/media/xueyuan_fujian/正式学员导入（示例）.xls" target="_blank" class="text-muted ">示例文件</a></small>
            </div>
            <div class="col-sm">
                <a class="btn btn-primary" href="/xueyuan/add/">新增学员</a>
            </div>
            <div class="col-sm">
                <a class="btn btn-primary" href="/xueyuan/add/">新增学员</a>
            </div>
    </div>

        <div class="card-body">
         <div class="row mb-3">
              {% include 'Xueyuan_Searchfrom.html' %}
         </div>
            <div class="row">
            <table class="table">
                <thead>
                    <tr>
                        <th>绑定客户ID</th>
                        <th>学员ID</th>
                        <th>学员姓名</th>
                        <th>报名时间</th>
                        <th>首次进班时间</th>
                        <th>学员订单</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                {% for item in Xueyuan_list %}

                <tr>
                    <td>{{ item.kehu.id }}</td>
                    <td>{{ item.id }}</td>
                    <td><a href="{% url 'Xueyuan_detail' item.id %}"> {{ item.kehu.username }}</a></td>
                    <td>{{ item.baomingtime }}</td>
                    <td>{{ item.xueyuan_jinbantime }}</td>
                    <td>
                        {% for xueyuan, dingdan_list in xueyuan_to_dingdan.items %}

                          {% for dingdan in dingdan_list.all %}

                              {% if dingdan.kehu.id == item.kehu.id %}
                                  订单号:{{dingdan.ddh}}-订单产品：{% for cpneane in dingdan.ddchanpin.all %}{{ cpneane }}<br>{% endfor %}
                              {% endif %}

                          {% endfor %}

                                    {% endfor %}


                                   </td>
                    <td>
                        <a class="btn btn-primary" href="{% url 'Xueyuan_Jinban_banji' item.id %}">学员进班</a>
                        <a class="btn btn-primary" href="{% url 'Xueyuan_detail' item.id %}">学员详情</a>
                    </td>
                </tr>
                {% endfor %}
                </tbody>



            </table>
            </div>
        <div class="row">
                <!-- 分页导航 -->
                <div class="pagination m-2">
                    <span class="step-links page-item m-2">
                        {% if has_previous %}
                            <a class="page-link" href="?page={{ previous_page_number }}">上一页</a>
                        {% endif %}

                    </span>
                        <span class="current page-link m-2">
                            页码 {{ page_obj.number }} / {{ page_obj.paginator.num_pages }}
                        </span>
                <span class="step-links page-item m-2">
                        {% if has_next %}
                            <a class="page-link"href="?page={{ next_page_number }}">下一页</a>
                        {% endif %}
                    </span>
                </div>
                <!-- 分页导航 -->
</div>

        </div>
    </div>

{% endblock %}
